# Author: WY
# Date: 2022/11/10 11:09

import numpy as np
import model.CNN_GRU_Model as CNN_GRU
import model.CNN_GRU_Model_multi as CNN_GRU_m
import model.DataLoader as loader
import pandas as pd
import matplotlib.pylab as plt
import torch


if __name__ == '__main__':
    # 获取数据集
    # dataframe = pd.read_csv('./data/stock/stock.csv')
    # dataframe = pd.read_csv('./data/temperature/kunming.csv')
    # dataframe = pd.read_csv('./data/temperature/climate.csv')
    # dataframe = pd.read_csv('./data/temperature/jena_climate_2009_2016.csv')
    dataframe = pd.read_csv('./data/temperature/p_56187(成都市)_01.01.2006_01.01.2023.csv')
    
    # data = np.array(dataframe[['Open', 'High', 'Low', 'Close', 'Volume']])
    # data = np.array(dataframe[['平均气温', '日最低气温', '平均气压', '日最低气压', '平均相对湿度']])
    # data = np.array(dataframe[['Temperature', 'Temperature in Kelvin', 'Temperature (dew point)', 'Relative Humidity', 'Pressure', 'Saturation vapor pressure', 'Vapor pressure', 'Vapor pressure deficit', 'Specific humidity', 'Water vapor concentration', 'Airtight', 'Wind speed', 'Maximum wind speed', 'Wind direction in degrees']])
    data = np.array(dataframe[['大气温度（摄氏度）', '水平大气压（毫米汞柱）', '海平面大气压（毫米汞柱）', '气压变化趋势', '相对湿度', '风向', '平均风速（m/s）', '过去12小时内最低气温', '过去12小时内最高气温', '水平能见度（km）', '露点温度（摄氏度）', '降水量（毫米）', '到达规定降水量的时间']])

    # dataloader_train, dataloader_test = loader.get_loader(split=CNN_GRU.split, batch_size=CNN_GRU.batch_size + CNN_GRU.pre_step, data=data)
    # dataloader_train, dataloader_test = loader.get_loader(split=CNN_GRU_m.split, batch_size=CNN_GRU_m.batch_size + CNN_GRU_m.pre_step, data=data)

    '''
    # CNN_GRU.test(dataloader_train)

    CNN_GRU.train(dataloader_train)
    CNN_GRU.bias_test(dataloader_train)
    CNN_GRU.variance_test(dataloader_test)
    '''

    for step in range(10, 11):
        dataloader_train, dataloader_test = loader.get_loader(split=CNN_GRU_m.split, batch_size=CNN_GRU_m.batch_size + step, data=data)
        CNN_GRU_m.performance_record(step, dataloader_train, dataloader_test)


